﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace YGame.Base
{
	public class IpcCommand : MarshalByRefObject
	{
		public const string ChannelName = "AppFrameChannel";
		public string CommandName { get; set; }
		public static IAppFrameService AppFrameService{ get; set; }

		public IpcCommand()
		{
		}

		public int Execute(Dictionary<string, string> args)
		{
			if (args != null)
			{
				Trace.WriteLine("IpcCommand.Execute args:");
				foreach (var item in args)
				{
					Trace.WriteLine(string.Format("key={0}, value={1}", item.Key, item.Value));
					switch (item.Key)
					{
						case "quit":
							AppFrameService.OnShutdown(item.Value);
							break;
						case "load":
							AppFrameService.OnLoadModel(item.Value);
							break;
						default:
							break;
					}
				}
			}
			return 0;
		}



	}
}
